package cn.com.dhc.danlu.activity.delivery;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import cn.com.dhc.danlu.R;
import cn.com.dhc.danlu.activity.BaseActivity;
import cn.com.dhc.danlu.util.CommonConst;

/**
 * 发票信息页面
 *
 * @author wzf
 */
public class DeliveryInvoiceMessageActivity extends BaseActivity {
    /**
     * 发票类型
     */
    private TextView txtInvoiceSort;
    /**
     * 公司名
     */
    private TextView txtCompanyName;
    /**
     * 纳税人识别码
     */
    private TextView txtPersonNum;
    private TextView txtCompanyNameTitle;
    private TextView txtPersonNumTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        getDelegate().setContentView(R.layout.layout_delivery_detail_invoice, R.layout_order_detail_buyer_words.class);
        setContentView(R.layout.activity_delivery_invoice_message);

        initViews();
        setViews();
    }

    private void initViews() {
        txtInvoiceSort = (TextView) findViewById(R.id.txtInvoiceSort);
        txtCompanyName = (TextView) findViewById(R.id.txtCompanyName);
        txtPersonNum = (TextView) findViewById(R.id.txtPersonNum);
        txtCompanyNameTitle = (TextView) findViewById(R.id.txtCompanyNameTitle);
        txtPersonNumTitle = (TextView) findViewById(R.id.txtPersonNumTitle);
        findViewById(R.id.llytBack).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected String getActivityTitle() {
        return null;
    }

    /**
     * 设置数据
     */
    private void setViews() {
        if (getIntent() != null && getIntent().getStringExtra(CommonConst.MyOrderDetailConst.ORDER_SORT) != null) {
            if (getIntent().getStringExtra(CommonConst.MyOrderDetailConst.ORDER_SORT).equals(CommonConst.MyOrderDetailConst.NORMAL_INVOICE)) {
                txtCompanyNameTitle.setText("发票抬头");
                txtInvoiceSort.setText("普通发票");
                txtCompanyName.setText(getIntent().getStringExtra("NORMAL_INVOICE_HEADER"));
                txtPersonNumTitle.setVisibility(View.GONE);
                txtPersonNum.setVisibility(View.GONE);
            } else {
                txtCompanyNameTitle.setText("单位名称");
                txtInvoiceSort.setText("增值税发票");
                txtPersonNumTitle.setVisibility(View.VISIBLE);
                txtPersonNum.setVisibility(View.VISIBLE);
                txtCompanyName.setText(getIntent().getStringExtra(CommonConst.MyOrderDetailConst.COMPANY_NAME));
                txtPersonNum.setText(getIntent().getStringExtra(CommonConst.MyOrderDetailConst.PERSON_NUM));
            }
        }
    }
}
